package cn.tedu.map;

import java.util.*;

/**
 * @author ：Dsi
 * @date ：2021/11/19 10:02
 * Describe ：该类用于回顾MAP
 */
public class TestMap {
    public static void main(String[] args) {
        Map<String,Integer> m=new HashMap<>();
        m.put("张三",3);
        m.put("李四",4);
        m.put("王五",5);
        m.put("王五", null);
        m.put(null, 6);
        System.out.println(m.isEmpty());
        System.out.println(m.containsKey("张三"));
        System.out.println(m.containsValue(5));
        System.out.println(m.get("李四"));
        System.out.println(m.remove("张三"));
        System.out.println(m);
        m.values();

        System.out.println("======----------=======");
        Set<Map.Entry<String, Integer>> s = m.entrySet();
        Iterator<Map.Entry<String, Integer>> si = s.iterator();
        while (si.hasNext()){
            System.out.println(si.next());
        }
        System.out.println("======----------=======");
        for (Map.Entry<String,Integer> a:s
             ) {
            System.out.println(a);
        }
        System.out.println("======----------=======");
        Set<String> k = m.keySet();
        for (String a:k
             ) {
            System.out.println(a+m.get(a));
        }


    }
}
